<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <div class="head">站点设置</div>
      <div id="model1">
        <el-form-item label="站点标题：" label-width="200px" style="height: 40px;">
          <el-input v-model="form.webTitle" style="width: 400px"></el-input>
        </el-form-item>
        <el-form-item label="站点关键词：" label-width="200px" style="height: 40px;">
          <el-input v-model="form.webAntistop" style="width: 400px"></el-input>
        </el-form-item>
        <el-form-item label="站点描述：" label-width="200px" style="width: 600px">
          <el-input type="textarea" v-model="form.webDescribe" :autosize="{ minRows: 3, maxRows: 3}"></el-input>
        </el-form-item>
        <el-form-item label="站点版权：" label-width="200px" style="height: 40px;">
          <el-input v-model="form.webCopyright" style="width: 400px"></el-input>
        </el-form-item>
        <el-form-item label="站点备案号：" label-width="200px" style="height: 40px;">
          <el-input v-model="form.webRecords" style="width: 400px"></el-input>
        </el-form-item>
        <el-form-item label="站点公安备案号:" label-width="200px" style="height: 40px; font-weight:bold;font-size:14px">
          <el-input v-model="form.webPolice" style="width: 400px"></el-input>
        </el-form-item>
        <el-form-item label="用户协议：" label-width="200px" style="font-weight:bold;font-size:14px;width: 80%">
          <el-input type="textarea" v-model="form.webAgreement" :autosize="{ minRows: 13, maxRows: 13}"></el-input>
        </el-form-item>
      </div>
      <div class="head">客服信息</div>
      <div id="model2">
        <el-form-item label="客服设置：" label-width="200px" style="height: 40px; font-weight:bold;font-size:14px;float: left">
          <el-radio-group v-model="form.serviceSet">
            <el-radio :label="1">是</el-radio>
            <el-radio :label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="客服信息1：" label-width="200px" style="height: 40px;float: left">
          <el-input v-model="form.serviceOne" style="width: 400px"></el-input>
        </el-form-item>
        <el-form-item label="客服信息2：" label-width="200px" style="height: 40px;float: left">
          <el-input v-model="form.serviceTwo" style="width: 400px"></el-input>
        </el-form-item>
      </div>
      <div class="head">统计信息</div>
      <div id="model3">
        <el-form-item label="统计设置：" label-width="200px" style="height: 40px; font-weight:bold;font-size:14px">
          <el-radio-group v-model="form.statisticsSet">
            <el-radio :label="1">开启</el-radio>
            <el-radio :label="2">关闭</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="统计代码：" label-width="200px" style="width: 600px">
          <el-input type="textarea" v-model="form.statisticsCode" :autosize="{ minRows: 3, maxRows: 3}"></el-input>
        </el-form-item>
      </div>
      <div class="head">讲师招募</div>
      <div id="model4">
        <el-form-item label="招募信息：" label-width="200px" style="width: 80%;">
          <el-input type="textarea" v-model="form.recruitMessage" :autosize="{ minRows: 13, maxRows: 13}"></el-input>
        </el-form-item>
        <el-form-item label="入驻协议：" label-width="200px" style="width: 80%">
          <el-input type="textarea" v-model="form.enterAgreement" :autosize="{ minRows: 13, maxRows: 13}"></el-input>
        </el-form-item>
      </div>
      <div style="text-align: right;padding-right: 200px">
        <el-form-item>
          <el-button type="primary" @click="onSubmit">确定</el-button>
          <el-button @click="findAll">取消</el-button>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>

<script>
    import qs from "qs";
    export default {

      name: "webSet",
      data() {
        return {
          form:{
            webTitle:'',//站点标题
            webAntistop:'',//站点关键词
            webDescribe:'',//站点描述
            webCopyright:'',//站点版权
            webRecords:'',//备案号
            webPolice:'',//站点公安备案号
            webAgreement:'',//用户协议
            serviceSet:'',//客服设置
            serviceOne:'',//客服信息1
            serviceTwo:'',//客服信息2
            statisticsSet:'',//统计设置
            statisticsCode:'',//统计代码
            recruitMessage:'',//招募信息
            enterAgreement:'',//入驻协议
          }
        }
      },
      methods: {
        onSubmit() {
          this.$axios.post("webSet/webset/web-set/updWebSet",qs.stringify(this.form)).then(r=>{
            if (r.data==true){
              this.open2()
            }else {
              this.open4()
            }
          })
        },findAll(){
          this.$axios.get("webSet/webset/web-set/findAll").then(r=>{
            this.form=r.data;
          })
        },open2() {
          this.$message({
            message: '恭喜你，修改成功',
            type: 'success'
          });
        },
        open4() {
          this.$message.error('错误，修改失败');
        }
      },
      created(){
        this.findAll()
      }
    }
</script>

<style scoped>
  .head{
    background-color: #F4F4F5;
    padding: 10px 20px;
    font-size: 15px;
    color: gray;
  }
  #model1{
    padding: 20px 0;
    font-weight:bold;
    font-size:14px;
  }
  #model2{
    height: 50px;
    padding: 10px 0;
  }
</style>
